function [i,j]=ij(l,nx)
j = fix(l/(nx+1))+1;
if mod(l,nx+1) ==0
    j = j-1;
end
i = l-((j-1)*(nx+1));